package com.practice;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegularExpressionPractice {

	public static void run() {
		Pattern pattern = Pattern.compile("[^a-zA-Z0-9_-]");
		Matcher matcher = pattern.matcher("l!k#s*s3_j+iud");
		StringBuffer sb = new StringBuffer();
		while (matcher.find()) {
			matcher.appendReplacement(sb, "_");
		}
		matcher.appendTail(sb);
		System.out.println(sb.toString());
	}
}
